package GUI窗体和Swing.事件处理机制;
//测试


import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class text1 {
    public static void main(String[] args) {
        JFrame jf = new JFrame("事件处理机制示例");
        JButton jb = new JButton("点击我");
        jf.add(jb);
        jb.addActionListener(new ActionListener() {
                                 public void actionPerformed(ActionEvent e) {
                                     System.out.println("你点击了按钮");
                                 }
                             });

        jf.setBounds(200, 200, 300, 200);
        jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        jf.setVisible(true);
    }
}
